<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s"  uri="/struts-tags"%>

<script type="text/javascript" src="<%=request.getContextPath()%>/js/credit/jquery.uitablefilter.js"></script>

<meta name="decorator" content="none" />
<s:hidden name="dostate" id="dostate" value="%{#request.dostate}"/>
<div id="infor">

<form id="filter-form2">
查询关键字：<s:textfield id="filterworld"/>
</form>
<table class="table_box table_bottom_border" >
<s:if test="dostate=='keepInfor'">
<tr>
		<th style="width:10%"><b>编号</b></th>
		<th style="width:25%"><b>保证人名称</b></th>
		<th style="width:25%"><b>本币银行</b></th>
		<th style="width:25%"><b>本币账号</b></th>
		<th style="width:10%"><b>关系</b></th>
		<th style="width:5%"><b>选择</b></th>
	</tr>
</s:if><s:elseif test="dostate=='hypothecate'">
<tr>
		<th style="width:10%"><b>物品编号</b></th>
		<th style="width:15%"><b>抵押人编号</b></th>
		<th style="width:25%"><b>抵押人</b></th>
		<th style="width:25%"><b>主要抵押物名称</b></th>
		<th style="width:10%"><b>现值</b></th>
		<th style="width:10%"><b>关系</b></th>
		<th style="width:5%"><b>选择</b></th>
	</tr>
</s:elseif><s:elseif test="dostate=='pledge'">
<tr>
		<th style="width:10%"><b>物品编号</b></th>
		<th style="width:15%"><b>出质人编号</b></th>
		<th style="width:25%"><b>出质人</b></th>
		<th style="width:25%"><b>主要质押物名称</b></th>
		<th style="width:10%"><b>现值</b></th>
		<th style="width:10%"><b>关系</b></th>
		<th style="width:5%"><b>选择</b></th>
	</tr>
</s:elseif>
</table>

<table class="table_box table_bottom_border" id="khpresultListTable">
	<s:if test="dostate=='keepInfor'">
		<s:iterator value="creditEnsurePeopleBeanList" status="index" var="var">
			<tr>
				<td style="width:10%"><s:if test="relationpeopletype==1">RF01</s:if><s:elseif test="relationpeopletype==2">RF02</s:elseif>${peopleId }</td>
				<td style="width:25%">${peopleName }</td>
				<td style="width:25%">${basicBank }</td>
				<td style="width:25%">${foreginBank }</td>
				<td style="width:10%">
				<s:if test="relationpeopletype==1">个人</s:if><s:elseif test="relationpeopletype==2">企业</s:elseif>
				</td>
				<td style="width:5%"><input type="checkbox" name="checkbox"/></td>
			</tr>
		</s:iterator>
	</s:if><s:elseif test="dostate=='hypothecate'">
	<s:iterator value="creditHypothecateThingBeanList" status="index" var="var">
			<tr>
				<td style="width:10%">${id }</td>
				<td style="width:15%"><s:if test="relationpeopletype==1">RF01</s:if><s:elseif test="relationpeopletype==2">RF02</s:elseif>${peopleid }</td>
				<td style="width:25%">${peopleName }</td>
				<td style="width:25%">${thingName }</td>
				<td style="width:10%">${price }</td>
				<td style="width:10%">
				<s:if test="relationpeopletype==1">个人</s:if><s:elseif test="relationpeopletype==2">企业</s:elseif>
				</td>
				<td style="width:5%"><input type="checkbox" name="checkbox"/></td>
			</tr>
		</s:iterator>
	</s:elseif><s:elseif test="dostate=='pledge'">
	<s:iterator value="creditPledgeThingBeanList" status="index" var="var">
			<tr>
				<td style="width:10%">${id }</td>
				<td style="width:15%"><s:if test="relationpeopletype==1">RF01</s:if><s:elseif test="relationpeopletype==2">RF02</s:elseif>${peopleid }</td>
				<td style="width:25%">${peopleName }</td>
				<td style="width:25%">${thingName }</td>
				<td style="width:10%">${price }</td>
				<td style="width:10%">
				<s:if test="relationpeopletype==1">个人</s:if><s:elseif test="relationpeopletype==2">企业</s:elseif>
				</td>
				<td style="width:5%"><input type="checkbox" name="checkbox"/></td>
			</tr>
		</s:iterator>
	</s:elseif>
</table>
<s:div id="button_area">
	<input type="button" name="addInfor" id="addInfor" value="确定"/>
</s:div>
</div>
<script type="text/javascript">
<!--
		var _dostate = document.getElementById("dostate").value;
		$("#addInfor").click(function(){
			var tableList = $('#khpresultListTable').find(":checkbox");
			for(var i=0; i < tableList.length; i++){
				if(tableList[i].checked == true){
					var tableTr = $(tableList[i]).parent().parent();
					if(_dostate == "keepInfor"){
						$("#keepInfor").append("<tr><th style=\"width:25%\">保证人（全称）</th><td colspan='5' style=\"width:75%\">" + tableTr.find("td:eq(1)").text() + "</td></tr><tr><th style=\"width:25%\">基本账户开户行</th><th style=\"width:10%\">本币银行</th><td style=\"width:25%\">" + tableTr.find("td:eq(2)").text() +"</td><th style=\"width:10%\">本币账号</th><td style=\"width:25%\">" + tableTr.find("td:eq(3)").text() + "</td><td style=\"width:5%\"><input type='button' value='删除' onClick='getDel(this)'/></td></tr>" + 
							"<tr><th style=\"width:25%\"></th><th style=\"width:10%\">保证人编号：</th><td style=\"width:25%\"><input type=\"text\" name='keepInforHidden' readOnly='true' value=" + tableTr.find("td:eq(0)").text() + "></td><th style=\"width:10%\">关系人类型：</th><td style=\"width:25%\"><input type='text' name='keepInforHiddenRPT' readOnly='true' value=" + tableTr.find("td:eq(4)").text() + "></td></tr>");
					}else if(_dostate == "hypothecate"){
						$("#hypothecate").append("<tr><th style=\"width:25%\">抵押人（全称）</th><td colspan='5' style=\"width:75%\">" + tableTr.find("td:eq(2)").text() + "</td></tr><tr><th style=\"width:25%\">主要抵押物名称</th><td colspan='2' style=\"width:25%\">" + tableTr.find("td:eq(3)").text() +"</td><th style=\"width:5%\">现值</th><td style=\"width:40%\">" + tableTr.find("td:eq(4)").text() + "</td><td style=\"width:5%\"><input type='button' value='删除' onClick='getDel(this)'/></td></tr>" + 
							"<tr><th style=\"width:25%\"></th><th colspan='5' style=\"width:75%\" align='left'>物品编号:<input type='text' readOnly='true' name='hypothecateHidden' value=" + tableTr.find("td:eq(0)").text() + ">抵押人编号:<input type='text' name='hypothecateHiddenPI' readOnly='true' value=" + tableTr.find("td:eq(1)").text() + ">关系人类型:<input type='text' name='hypothecateHiddenRPT' readOnly='true' value=" + tableTr.find("td:eq(5)").text() + "></th></tr>");
					}else if(_dostate == "pledge"){
						$("#pledge").append("<tr><th style=\"width:25%\">质押人（全称）</th><td colspan='5' style=\"width:75%\">" + tableTr.find("td:eq(2)").text() + "</td></tr><tr><th style=\"width:25%\">主要质押物名称</th><td colspan='2' style=\"width:25%\">" + tableTr.find("td:eq(3)").text() +"</td><th style=\"width:5%\">现值</th><td style=\"width:40%\">" + tableTr.find("td:eq(4)").text() + "</td><td style=\"width:5%\"><input type='button' value='删除' onClick='getDel(this)'/></td></tr>" + 
							"<tr><th style=\"width:25%\"></th><th colspan='5' style=\"width:75%\" align='left'>物品编号:<input type='text' name='pledgeHidden' readOnly='true' value=" + tableTr.find("td:eq(0)").text() + ">出质人编号:<input type='text' name='pledgeHiddenPI' readOnly='true' value=" + tableTr.find("td:eq(1)").text() + ">关系人类型:<input type='text' name='pledgeHiddenRPT' readOnly='true' value=" + tableTr.find("td:eq(5)").text() + "></th></tr>");
					}
				}
			}
			$("#OpenDialog").dialog("close");
		});
			function getDel(keepInfor){
				$(keepInfor).parent().parent().prev().remove();
				$(keepInfor).parent().parent().next().remove();
				$(keepInfor).parent().parent().remove();
				}
//-->
</script>

<script type="text/javascript">
<!--
$(function() { 
	var theTable = $("#khpresultListTable");
	$("#filterworld").keyup(function() {
	    $.uiTableFilter( theTable, this.value );
	  });

	  $('#filter-form2').submit(function(){
	    theTable.find("tbody > tr:visible > td:eq(2)").mousedown();
	    return false;
	  }).focus(); //Give focus to input field
	});
//-->
</script>
